<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=Edge" />
    <link
      rel="stylesheet"
      type="text/css"
      href="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.43.0/codemirror.css"
    />
    <link
      rel="stylesheet"
      type="text/css"
      href="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.43.0/addon/lint/lint.css"
    />
    <link
      rel="stylesheet"
      type="text/css"
      href="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.43.0/theme/neo.css"
    />
    <link rel="stylesheet" type="text/css" href="./css/example.css" />
    <link rel="stylesheet" href="../dist/toastui-chart.css" />
    <title>2.16 [Stack Bar Chart] Data Labels Theme</title>
  </head>
  <body>
    <div class="description">
      You can see the tutorial
      <a href="https://github.com/nhn/tui.chart/blob/main/docs/en/chart-bar.md" target="_blank">here</a>
      <br />
      <strong
        >The example code can be slower than your environment because the code is transpiled by
        babel-standalone in runtime.</strong
      >
    </div>
    <div class="wrap">
      <div class="code-html" id="code-html">
        <div id="chart-area"></div>
      </div>
      <div class="custom-area">
        <div id="error-dim">
          <span id="error-text"></span>
          <div id="error-stack"></div>
          <span id="go-to-dev-tool"
            >For more detail, open browser's developer tool and check it out.</span
          >
        </div>
        <div class="try-it-area">
          <h3>try it</h3>
          <textarea id="code"></textarea>
          <div class="apply-btn-area">
            <button class="btn" onclick="evaluationCode(chartCM, codeString);">Run it!</button>
          </div>
        </div>
      </div>
    </div>
    <script src="https://unpkg.com/babel-standalone@6.26.0/babel.min.js"></script>
    <script src="../dist/toastui-chart.js"></script>
    <script class="code-js" id="code-js" type="text/babel">
      const el = document.getElementById('chart-area');
      const data = {
        categories: ['May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct'],
        series: [
          {
            name: 'Budget',
            data: [4000, 5000, 3000, 5000, 7000, 6000],
          },
          {
            name: 'Income',
            data: [7000, 8000, 2000, 7000, 2500, 7000],
          },
          {
            name: 'Expenses',
            data: [-5000, -4000, -4000, -6000, -3000, -4000],
          },
          {
            name: 'Debt',
            data: [-3000, -6000, -3000, -5000, -2000, -1500],
          },
        ],
      };
      const theme = {
        series: {
          dataLabels: {
            fontFamily: 'monaco',
            lineWidth: 2,
            textStrokeColor: '#ffffff',
            shadowColor: '#ffffff',
            shadowBlur: 4,
            stackTotal: {
              fontFamily: 'monaco',
              fontWeight: 14,
              color: '#ffffff',
              textBubble: {
                visible: true,
                paddingY: 6,
                borderWidth: 3,
                borderColor: '#00bcd4',
                borderRadius: 7,
                backgroundColor: '#041367',
                shadowOffsetX: 0,
                shadowOffsetY: 0,
                shadowBlur: 0,
                shadowColor: 'rgba(0, 0, 0, 0)',
              },
            },
          },
        },
      };

      const options = {
        chart: { title: 'Monthly Revenue', width: 900, height: 400 },
        series: {
          stack: true,
          dataLabels: {
            visible: true,
            anchor: 'center',
          },
        },
        legend: {
          align: 'bottom',
        },
        theme,
      };

      const chart = toastui.Chart.barChart({ el, data, options });
    </script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.59.0/codemirror.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.59.0/addon/edit/matchbrackets.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.59.0/addon/selection/active-line.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.59.0/mode/javascript/javascript.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.59.0/addon/lint/lint.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.59.0/addon/lint/javascript-lint.js"></script>
    <script src="./js/example.js" type="text/babel"></script>
  </body>
</html>
